package com.zz.ecommerce.identityManage.personalIdentityMgn;

import com.zz.ecommerce.common.GridRequest;
import com.zz.ecommerce.common.GridResult;
import com.zz.ecommerce.common.constants.TableConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by zhangguowei on 2016/3/28.
 */
@Controller
@RequestMapping("/identityMgn/personal")
public class PersonalIdentityMgnController {

    private static final Logger LOG = LoggerFactory.getLogger(PersonalIdentityMgnController.class);

    @Autowired
    private PersonalIdentityDao personalIdentityDao;

    /**
     * 个人身份认证管理 页面跳转
     *
     * @return
     */
    @RequestMapping(value = "index", method = {RequestMethod.GET, RequestMethod.POST})
    public String index() {
        return "identity/personal/index";
    }


    /**
     * 个人身份认证管理 查询列表
     *
     * @param tPersonalIdentity
     * @param request
     * @return
     */
    @RequestMapping(value = "/queryPersonalIdentityList", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public GridResult queryPersonalIdentityList(TPersonalIdentity tPersonalIdentity, GridRequest request) {
        List<TPersonalIdentity> tPersonalIdentities = personalIdentityDao.page(TableConstants.T_PERSONAL_IDENTITY, tPersonalIdentity,
                request.getStart(), request.getEnd(), request.getSortOrder());
        return new GridResult<TPersonalIdentity>(tPersonalIdentities, request, personalIdentityDao.count(TableConstants.T_PERSONAL_IDENTITY, tPersonalIdentity));
    }
}
